define(["jquery", "easy-admin"], function ($, ea) {

    var init = {
        table_elem: '#currentTable',
        table_render_id: 'currentTableRenderId',
        index_url: 'mall.order/index',
        add_url: 'mall.order/add',
        edit_url: 'mall.order/edit',
        delete_url: 'mall.order/delete',
        export_url: 'mall.order/export',
        modify_url: 'mall.order/modify',
        send_url: 'mall.order/send',
    };

    return {

        index: function () {
            ea.table.render({
                init: init,
                cols: [[
                    {type: 'checkbox'},
                    // {field: 'id', title: '主键ID'},
                    {field: 'order_no', title: '订单号'},
                    {field: 'shop_order_no', title: '商城订单号'},
                    // {field: 'app_user_id', title: '应用用户ID'},
                    {field: 'app_user_name', title: '应用用户名称'},
                    {field: 'sent_to_user', title: '收货人姓名'},
                    // {field: 'sent_to_address', title: '收货人地址'},
                    // {field: 'sent_to_tel', title: '收货人联系方式'},
                    // {field: 'remark', title: '备注', templet: ea.table.text},
                    {field: 'status', search: 'select', selectList: notes?.status || {}, title: '状态',
                    templet: function (d) {
                        if (d.status === 0) {
                            return '<span class="layui-badge layui-bg-blue">未发货</span>';
                        }else if (d.status === 1) {
                            return '<span class="layui-badge">已发货</span>';
                        }else if (d.status === 2) {
                            return '<span class="layui-badge layui-bg-gray">已完成</span>';
                        }else {
                            return '<span class="layui-badge-rim">未知</span>';
                        }
                    }},
                    {field: 'create_time', search: 'range', title: '创建时间'},
                    {
                        width: 250,
                        title: '操作',
                        templet: ea.table.tool,
                        operat: [
                            [ {
                                text: '查看',
                                url: init.edit_url,
                                method: 'open',
                                auth: 'edit',
                                class: 'layui-btn layui-btn-xs layui-btn-success',
                                extend: 'data-width="90%" data-height="95%"',
                            }, {
                                text: '发货',
                                url: init.send_url,
                                method: 'open',
                                auth: 'send',
                                class: 'layui-btn layui-btn-xs layui-btn-normal',
                                extend: 'data-width="90%" data-height="95%"',
                                visible: function (row) {
                                    return row.status === 0;
                                },
                            }],
                            'delete']
                    }

                ]],
            });

            ea.listen();
        },
        add: function () {
            ea.listen();
        },
        edit: function () {
            ea.listen();

            
        },
        send: function () {
            ea.listen();
            $('.send_type').click(function() {
              alert(11)
            })
        },
    };
});